#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

#include "json.h"
#include "parser.h"
using namespace sf::json;

int main(int argc, char *argv[])
{

   ifstream fin("./test.json");
   stringstream ss;
   ss << fin.rdbuf();
   const string &str = ss.str();
   cout << str << endl;
   cout << endl;

   Json v;
   v.parse(str);
   // string opt01 = v["options"]["date"]["time"];
   // string opt02 = v["options"]["cwd"];
   // bool bt = v["options"]["date"]["trub"];

   // cout << v.str() << endl;
   // cout << endl;
   // cout << "---------------------------------------" << endl;
   // cout << opt01 << endl;
   // cout << opt02 << endl;
   // cout << bt << endl;
   cout << v["options"]["date"]["data02"].str() << endl;
   Json arr = v["options"]["date"]["data02"];
   for (auto it = arr.begin(); it != arr.end(); it++)
   {
      auto tmp = *it;
      cout << tmp.str() << endl;
   }
   cout << "---------------------------------------" << endl;
   cout << arr[0].asInt() << endl;
   cout << arr[1].asInt() << endl;
   cout << arr[2].asDouble() << endl;
   cout << arr[3].asString() << endl;
   cout << arr[4].asString() << endl;

   return 0;
}
